# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=arpon
pkgver=3.0
_realver=3.0-ng
pkgrel=6
pkgdesc="Arp handler inspectiON is a handler daemon with tools to handle all ARP aspects"
url="https://arpon.sourceforge.io/"
arch="all"
license="BSD-2-Clause"
makedepends="libdnet-dev libpcap-dev libnet-dev cmake samurai"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://downloads.sourceforge.net/project/arpon/arpon/ArpON-$_realver.tar.gz
	fix-ppc64le-werror.patch
	arpon-gcc8.patch
	arpon.initd
	arpon.confd
	"

builddir="$srcdir"/ArpON-$_realver

build() {
	cmake -B build -G Ninja \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		.
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="e6338018d65f3f8300958e168a9eb6f6be85cba21ae0aee4b03e9838a29a06afbf2448c2f104367aa18389cc549e4489bcf8dad384ad46eadf2884a0908238af  ArpON-3.0-ng.tar.gz
d7ac9e46a43ac332926efe959373790ca2b5ae07e9a02186bff257014928ed5a101ff6d8b6224a7291f7bb25fe5555510cbf688a062d85afb7b7d9b3f6285ee9  fix-ppc64le-werror.patch
eb4b9087a61c31fa99a7c4104e20172101b4ac3abcd448a41bdd31a81768a3dc996c9b220fd50b3c8906c050c4362c0cef300f5625cb02a7f51246783a915786  arpon-gcc8.patch
9a7c862c3b07e31da091906b61339680b23af154c088eb259f2540916273d8e5f4dc6af5f883564d5b2ede6552b55376aa37b413270f837067ec5ce3d61a076f  arpon.initd
c368acd8b0f9945a750e5c39a22fdad2a10f117270cd07f641333fbb9c22223cbf18809665d8675732408e820da5a806dac10c78ab0b9f2dae58cacbe58c61c1  arpon.confd"
